
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
/** @author  John Miller
 *  @version 1.1
 *  @date    Sun Nov 15 15:05:06 EDT 2009
 *  @see     LICENSE (MIT style license file).
 */

package scalation.event

//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
/** The `Entity` class represents a single simulation entity for event-scheduling 
 *  simulation.
 *  @param arrivalT  the time at which the entity arrived
 *  @param serviceT  the amount of time required for the entity's next service
 */
case class Entity (val arrivalT: Double, var serviceT: Double)
{
    /** the entity id
     */
    val eid = Entity.next ()

    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    /** Convert the entity to a string
     */
    override def toString = "Entity-" + eid

} // Entity class


//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
/** The `Entity` companion object provides a counter for generating entity ids.
 */
object Entity
{
    private var eCount = 0           // counter for generating entity ids

    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    /** Return the next id number
     */
    def next (): Int = { eCount += 1; eCount }

} // Entity companion object

